// ... existing code ...
    updateSelectedTotalQty() {
      // 合并精华液和投料单数据
      const mergedData = [...this.expandedRow, ...this.expandedPlanRow];
      
      // 按产品编码分组统计
      const groupMap = mergedData.reduce((acc, item) => {
        const key = item.MaterialCode;
        if (!acc[key]) {
          acc[key] = {
            materialCode: key,
            totalQty: 0,
            reqQty: item.ReqQty || 0
          };
        }
        acc[key].totalQty += item.DistributeQty || 0;
        return acc;
      }, {});

      // 更新分组数据
      this.selectedGroups = Object.values(groupMap).map(group => ({
        ...group,
        remaining: group.reqQty - group.totalQty
      }));

      // 计算总剩余量（根据需求决定是否保留）
      this.remainingAllocationQty = this.selectedGroups.reduce(
        (sum, group) => sum + group.remaining,
        0
      );
    },
// ... existing code ...
